﻿using BUS;
using DTO;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QLBV_Nhom8
{
    public partial class frmHenTaiKham : Form
    {
        public frmHenTaiKham()
        {
            InitializeComponent();
        }

        private void btnHuy_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void frmHenTaiKham_Load(object sender, EventArgs e)
        {

        }

        private void btnXacNhan_Click(object sender, EventArgs e)
        {
            try
            {
                DangKyKhamBenhDTO obj = new DangKyKhamBenhDTO();
                obj.NgayDangKy = dtpNgayDangKy.Value;
                obj.NgayKham = dtpNgayKham.Value;
                obj.HoTen = txtHoTen.Text;
                obj.NgaySinh = dtpNgaySinh.Value;
                if (r_Nam.Checked)
                    obj.GioiTinh = "Nam";
                else
                    obj.GioiTinh = "Nữ";
                obj.DiaChi = txtDiaChi.Text;
                obj.YeuCauKham = txtYeuCauKham.Text;

                DangKyKhamBenhBUS.ThemDangKyKhamBenh(obj);
                MessageBox.Show("Hẹn thành công.");
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                MessageBox.Show("Hẹn thất bại.");
            }
        }

        private void btnHuy_Click_1(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
